package com.yayo.mangement.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yayo.mangement.dao.SysMenuDao;
import com.yayo.mangement.model.SysMenuDO;
import com.yayo.mangement.service.SysMenuService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 
 * @author: Yayo
 * @date: 2020-07-15 13:23:49
 */
@Service
public class SysMenuServiceImpl  extends ServiceImpl<SysMenuDao, SysMenuDO> implements SysMenuService {

    @Override
    public List<SysMenuDO> list(){
        LambdaQueryWrapper query = Wrappers.<SysMenuDO>lambdaQuery();
        return baseMapper.selectList(query);
    }

    @Override
    public SysMenuDO findById(Long id){
        return baseMapper.selectById(id);
    }

    @Override
    public Boolean create(SysMenuDO sysMenuDO){
        return baseMapper.insert(sysMenuDO) > 0;
    }

    @Override
    public Boolean update(SysMenuDO sysMenuDO){
        return baseMapper.updateById(sysMenuDO) > 0;
    }

    @Override
    public Boolean delete(Long id){
        return baseMapper.deleteById(id) > 1;
    }

    @Override
    public List<SysMenuDO> findByIds(List<Long> menuIdList) {
        return baseMapper.selectBatchIds(menuIdList);
    }
}